/*
 * trdp_mini_types.h
 *
 *  Created on: 2016年12月7日
 *      Author: ZhangYu @ DL-LaiKe
 */

#ifndef API_TRDP_MINI_TYPES_H_
#define API_TRDP_MINI_TYPES_H_

/***********************************************************************************************************************
 * INCLUDES
 */

#ifdef __cplusplus
extern "C" {
#endif

typedef unsigned char  BOOLEAN;
typedef unsigned char  INT8U;                    /* Unsigned  8 bit quantity                           */
typedef signed   char  INT8S;                    /* Signed    8 bit quantity                           */
typedef unsigned short INT16U;                   /* Unsigned 16 bit quantity                           */
typedef signed   short INT16S;                   /* Signed   16 bit quantity                           */
typedef unsigned int   INT32U;                   /* Unsigned 32 bit quantity                           */
typedef signed   int   INT32S;                   /* Signed   32 bit quantity                           */
typedef float          FP32;                     /* Single precision floating point                    */
typedef double         FP64;                     /* Double precision floating point                    */

#ifndef ERROR
#define ERROR           (0)						/* function return failed */
#endif

#ifndef OK
#define OK              (1)						/* function return success */
#endif

#ifndef NULL
#define NULL            (0)						/* null pointer */
#endif

#ifndef TRUE
#define TRUE            (1)
#define FALSE           (0)
#endif


/** Various flags for PD and MD Block control block   */
typedef enum
{
    COM_UDP_UNICAST 	 = 0x01,        				/**< Default value defined in tlc_openDession will be taken     */
	COM_UDP_BROADCAST	 = 0x02,					    /**< this block is for send data or receive data  0: request as source, 1: receive as suit  */
    COM_UDP_MULTICAST    = 0x04,     				    /**< enable or disable: 0-> disable 1-> enable                  */
	COM_TCP_UNICAST		 = 0x08							/**< for source port, 1: auto loop to send data, 0: send data only once   */
} COM_TYPE_T;

/** Action type for MD CallBack   */
typedef enum
{
    MD_DO_NOTHING 	 = 0,        				/**< Default value defined in tlc_openDession will be taken     */
	MD_NEED_REPLY	 = 1,					    /**< this block is for send data or receive data  0: request as source, 1: receive as suit  */
    MD_NEED_CONFIRM  = 2     				    /**< enable or disable: 0-> disable 1-> enable                  */
} MD_ACTION_T;

/** Return codes for all API functions, -1..-29 taken over from vos */
typedef enum
{
	TRDP_MINI_NO_ERR             = 0,    /**< No error  */
	TRDP_MINI_PARAM_ERR          = -1,   /**< Parameter missing or out of range              */
	TRDP_MINI_INIT_ERR           = -2,   /**< Call without valid initialization              */
	TRDP_MINI_NOINIT_ERR         = -3,   /**< Call with invalid handle                       */
	TRDP_MINI_TIMEOUT_ERR        = -4,   /**< Timout                                         */
	TRDP_MINI_NODATA_ERR         = -5,   /**< Non blocking mode: no data received            */
	TRDP_MINI_SOCK_ERR           = -6,   /**< Socket error / option not supported            */
	TRDP_MINI_IO_ERR             = -7,   /**< Socket IO error, data can't be received/sent   */
	TRDP_MINI_MEM_ERR            = -8,   /**< No more memory available                       */
	TRDP_MINI_SEMA_ERR           = -9,   /**< Semaphore not available                        */
	TRDP_MINI_QUEUE_ERR          = -10,  /**< Queue empty                                    */
	TRDP_MINI_QUEUE_FULL_ERR     = -11,  /**< Queue full                                     */
	TRDP_MINI_MUTEX_ERR          = -12,  /**< Mutex not available                            */
	TRDP_MINI_THREAD_ERR         = -13,  /**< Thread error                                   */
	TRDP_MINI_BLOCK_ERR          = -14,  /**< System call would have blocked in blocking mode  */
	TRDP_MINI_INTEGRATION_ERR    = -15,  /**< Alignment or endianess for selected target wrong */
	TRDP_MINI_NOCONN_ERR         = -16,  /**< No TCP connection                              */
	TRDP_MINI_NOSESSION_ERR      = -30,  /**< No such session                                */
	TRDP_MINI_SESSION_ABORT_ERR  = -31,  /**< Session aborted                                */
	TRDP_MINI_NOSUB_ERR          = -32,  /**< No subscriber                                  */
	TRDP_MINI_NOPUB_ERR          = -33,  /**< No publisher                                   */
	TRDP_MINI_NOLIST_ERR         = -34,  /**< No listener                                    */
	TRDP_MINI_CRC_ERR            = -35,  /**< Wrong CRC                                      */
	TRDP_MINI_WIRE_ERR           = -36,  /**< Wire                                           */
	TRDP_MINI_TOPO_ERR           = -37,  /**< Invalid topo count                             */
	TRDP_MINI_COMID_ERR          = -38,  /**< Unknown ComId                                  */
	TRDP_MINI_STATE_ERR          = -39,  /**< Call in wrong state                            */
	TRDP_MINI_APP_TIMEOUT_ERR    = -40,  /**< Application Timeout                            */
	TRDP_MINI_APP_REPLYTO_ERR    = -41,  /**< Application Reply Sent Timeout                 */
	TRDP_MINI_APP_CONFIRMTO_ERR  = -42,  /**< Application Confirm Sent Timeout               */
	TRDP_MINI_REPLYTO_ERR        = -43,  /**< Protocol Reply Timeout                         */
	TRDP_MINI_CONFIRMTO_ERR      = -44,  /**< Protocol Confirm Timeout                       */
	TRDP_MINI_REQCONFIRMTO_ERR   = -45,  /**< Protocol Confirm Timeout (Request sender)      */
	TRDP_MINI_PACKET_ERR         = -46,  /**< Incomplete message data packet                 */
	TRDP_MINI_UNKNOWN_ERR        = -99   /**< Unspecified error                              */
} TRDP_MINI_ERR_T;

#ifdef __cplusplus
}
#endif

#endif /* API_TRDP_MINI_TYPES_H_ */
